package com.yinshu.teleshield.config;

import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;

@Configuration
public class Knife4jConfig {

    @Bean
    public OpenAPI springOpenAPI() {
        return new OpenAPI().info(new Info() //
                .title("SpringDoc API Test") //
                .description("SpringDoc Simple Application Test") //
                .version("0.0.1"));
    }

    // 接口较多，可以进行分组，此处进行注释
    @Bean
    public GroupedOpenApi backendGroup() {
        return GroupedOpenApi.builder().group("user").displayName("user")
                .addOpenApiCustomizer(openApi -> openApi.info(new Info().title("后台 API").version("1.0.0")))
                .packagesToScan("com.yinshu.teleshield.controller")
                .pathsToMatch("/**")
                .build();
    }
}
